<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head>
    <meta charset="UTF-8"/>
    <title>videoDetail</title>
    <link rel="stylesheet" type="text/css" media="all" href="/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" media="all" href="/css/common.css"/>
    <link rel="stylesheet" type="text/css" media="all" href="/css/CaseManager.css"/>
    <link rel="stylesheet" type="text/css" media="all" href="/layui/css/layui.css"/>
    <script type="text/javascript" src="/layui/layui.all.js"></script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/myJs.js"></script>
</head>
<body>
<div  align="center">
    <div id="div0"></div><br/>
    <div id="div1" class="layui-form"></div>
    <br/><br/><br/><br/><br/><br/><br/>
</div>
<div class="layui-col-md-offset7">
    <a href="#" style="font-size: 22px;color: #01AAED;font-family: 等线 ;" onclick="xiazai()">《点击下载》</a>
</div>
<script th:inline="javascript" type="text/javascript">
    function xiazai(){

        // var it =JSON.parse(localStorage.getItem("username"))

        if (localStorage.getItem("username")==null) {
            var storage = window.localStorage;
            storage.setItem("username","未登陆") ;
        }
        var storages = window.localStorage;
            var url="/download/GetResource";
            var file = [[${fileName}]];
            var form = $("<form></form>").attr("action", url).attr("method", "get");
            form.append($("<input></input>").attr("type", "hidden").attr("name", "fileName").attr("value",file))
            form.append($("<input></input>").attr("type", "hidden").attr("name","username").attr("value",storages.username));
            form.appendTo('body').submit().remove();


    }
    $(function(){
        var name = [[${staticfile}]]
        var result ='<video src="'  + name +  '" width="700" height="500" controls="controls" controlslist="nodownload"></video>';
        var result2 = '<a href="#" style="font-size: 20px"><br/><br/>'+[[${title}]]+'</a>';
        // var result3 = '<a href="#"><br/><br/>简介：'+[[${fileExplain}]]+'</a>';
        $('#div0').append(result2);
        $('#div1').append(result);
        $('#div1').append(result3);
        layui.use('form', function(){
            var form = layui.form;
            form.render();
        });


        var storage = window.localStorage;
        var it =localStorage.getItem("username")
        var sourseID = [[${sourseID}]];
        if (it ==null){
            storage.username = "未登录";
        }
        $.get("/Request/UpdateRead",{"sourseID":sourseID,"username":storage.username},function (data) {

        })


    })

</script>
</body>


</html>